home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / Jotto2.so Folder / Jotto ][ ƒ / Wipes, etc. / BoxOut wipe.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-02  |  2.0 KB  |  60 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        BoxOut wipe.c
  4.  
  5. Purpose:    Graphic effect from offscreen bitmap to main window (on
  6.             screen).  See comments below for more description.
  7.  
  8.  
  9. Jotto ][ -=- a simple word game, revisited
  10. Copyright (C) 1993 Mark Pilgrim
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "msg timing.h"
  30. #include "wipe dispatch.h"
  31.  
  32. #define        BOXES    50    /* increase this for a finer grained but more timely effect */
  33. #define CorrectTime 1
  34.  
  35. void BoxOutWipe(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, short theWindowHeight, short theWindowWidth)
  36. {
  37.     Rect    theRect;
  38.     short        cenx, ceny;
  39.     short        boxnum;
  40.     
  41.     /* change this as appropriate for the source and destination bounds */
  42.     cenx = theWindowWidth / 2;
  43.     ceny = theWindowHeight / 2;
  44.     
  45.     for(boxnum = 0; boxnum <= BOXES; boxnum++)
  46.     {
  47.         StartTiming();
  48.         
  49.         /* this is not the most efficient method, but the overhead of the
  50.         multiplies and the redundant copying is hidden by the timing mechanism */
  51.         theRect.left = cenx - ((boxnum * cenx) / BOXES);
  52.         theRect.right = cenx + ((boxnum * cenx) / BOXES);
  53.         theRect.top = ceny - ((boxnum * ceny) / BOXES);
  54.         theRect.bottom = ceny + ((boxnum * ceny) / BOXES);
  55.         
  56.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  57.                 &theRect, &theRect, 0, 0L);
  58.         TimeCorrection(CorrectTime);
  59.     }
  60. }